var prefix = ctx + "module/customerAttendance"

$(function() {
	var columns = [{
            checkbox: true
        },
				{
			field : 'attendId', 
			title : '主键id' 
		},
				{
			field : 'attendCustName', 
			title : '客户姓名' 
		},
				{
			field : 'cellphoneNum', 
			title : '手机号码' 
		},
				{
			field : 'dept.deptName', 
			title : '所属部门' 
		},
				{
			field : 'user.loginName', 
			title : '业务员' 
		},		
				{
			field : 'isOwnself', 
			title : '是否本人',
			align: 'center',
            formatter: function(value, row, index) {
                if (value == '0') {
                    return '<span class="label label-success">本人</span>';
                } else if (value == '1') {
                    return '<span class="label label-danger">代咨询</span>';
                }
            }
		},
				{
			field : 'attendanceTime', 
			title : '参课时间' 
		},
				/*{
			field : 'createTime', 
			title : '创建时间' 
		},*/
		        {
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
            	var actions = [];
				actions.push('<a class="btn btn-primary btn-sm ' + editFlag + '" href="#" title="编辑" mce_href="#" onclick="edit(\'' + row.attendId + '\')"><i class="fa fa-edit"></i></a> ');
				/*actions.push('<a class="btn btn-warning btn-sm ' + removeFlag + '" href="#" title="删除" onclick="remove(\'' + row.attendId + '\')"><i class="fa fa-remove"></i></a>');*/
				return actions.join('');
            }
        }];
	var url = prefix + "/list";
	$.initTable(columns, url);
});

/*客户参课列-新增*/
function add() {
    var url = prefix + '/add';
    layer_showAuto("新增客户参课列", url);
}

/*客户参课列-修改*/
function edit(attendId) {
    var url = prefix + '/edit/' + attendId;
    layer_showAuto("修改客户参课列", url);
}

/*// 单条删除
function remove(id) {
	$.modalConfirm("确定要删除选中客户参课列吗？", function() {
		_ajax(prefix + "/remove/" + id, "", "post");
    })
}

// 批量删除
function batchRemove() {
	var rows = $.getSelections("attendId");
	if (rows.length == 0) {
		$.modalMsg("请选择要删除的数据", "warning");
		return;
	}
	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
		_ajax(prefix + '/batchRemove', { "ids": rows }, "post");
	});
}*/
